Skip to content

refactor(contracts): bind only the interactor families an owner implements - #4821

Merged
thymikee merged 5 commits into
mainfrom
t3/per-family-operation-binding
Nov 20, 2026
Merged

thymikee merged 5 commits into
mainfrom
t3/per-family-operation-binding

Conversation

@thymikee

@thymikee thymikee commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Two contracts aggregates made every runtime owner value-import every operation family:

  • interactor-operation-catalog.ts held all 31 rows and the adapters, so tv-cdp/runtime.ts → catalog → keyboard-runtime.ts (and clipboard, alert, settings, orientation, app-event).
  • platform-runtime-unavailable.ts called each family's facts builder, 21 families in all.

Now each family declares its rows beside its binders. The adapters move to interactor-operation-binding.ts and take the rows to walk. The catalog is the concatenation, for owners that implement every family. The TV runtime (Tizen, webOS) and Vega pass their own families. The unavailable hub states each operation by name, as it already did for fold.

No behaviour, wire, or plugin contract change. Facts still decide what binds. Not device-facing.

Value

Entry contracts files value-reached reachable lines
Tizen 41 → 27 16,013 → 14,317
webOS 41 → 27 15,889 → 14,193
Vega 38 → 19 11,883 → 9,212
Linux 41 → 37 16,149 → 15,893

Cherry-picked onto 0.22 in a scratch copy: Tizen plugin dist 92,076 → 85,194 bytes, webOS 90,648 → 83,766. Revyl, which binds every family, grows 164,175 → 165,101.

Validation

At 10215d4: pnpm check:quick, check:layering, check:fallow, check:production-exports, check:package, and the eager-closure budget test pass. 252 targeted test files pass (contracts, tv-cdp, Vega, Linux, Tizen, webOS, Limrun, Revyl, webdriver, HarmonyOS, Android runtime, Apple navigation/system, repo guards). The unavailable facts value is byte-identical before and after for distinct per-cell inputs. New tests in tv-cdp and Vega fail if facts admit a catalog operation the owner does not bind.

CI owns full unit coverage and device lanes. The final commit regenerates the contracts export snapshot for the new interactor-operation-binding subpath.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

thymikee and others added 2 commits November 20, 2026 16:47
…ments

Each family declares its catalog rows beside its binders, and the adapters
take the rows to walk. The TV runtime and Vega pass their own families, so
they no longer evaluate keyboard, clipboard, alert, settings, orientation
and app-event binders. The unavailable-facts hub states every operation by
name instead of calling each family's facts builder, which every owner
evaluated whether or not it implements the family.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Owners that bind a subset of families import the adapters from this
subpath, so the contracts export snapshot gains one specifier.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.46 MB 6.46 MB +1.7 kB
Package (unpacked) 6.46 MB 6.46 MB +1.7 kB
Package (download) 1.97 MB 1.97 MB +569 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 39.3 ms 49.4 ms +10.1 ms
CLI --help 84.7 ms 85.4 ms +0.7 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 10215d4. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

At 10215d4 this change drops the hover refusal hint for some devices, so it is not yet a pure refactor. There are no conflicts and CI is green.

On main, createUnavailablePlatformRuntimeFacts built the touch cells through touchRuntimeOperationFacts, which runs hoverPoint and hoverRef through withHoverRefusalHint (touch-runtime.ts:110-123). That adds HOVER_UNAVAILABLE_HINT when the cell is unavailable and has no hint. The inlined version at platform-runtime-unavailable.ts:219 sets hoverPoint: frozen.touch, hoverRef: frozen.touch, so a hint-less touch cell now gives a hover fact with no hint. Vega (unsupportedPlatformLeaf, platform-vega/src/runtime.ts:30,199) and the gateway's unsupported-provider-mode facts (src/platform-runtime-gateway.ts:352-374) reach this path with a hint-less cell. hover on those devices now refuses without the "available on web targets only… use longpress" guidance, and the hoverPoint/hoverRef capability facts change too. This contradicts the "byte-identical" and "no behaviour change" claims in the PR body.

The rule: every unavailable hover fact the hub emits carries the hover refusal hint unless the cell has its own hint. The smallest fix is to move HOVER_UNAVAILABLE_HINT and withHoverRefusalHint into a dependency-free leaf that both touch-runtime.ts and the hub import, then wrap both hover cells with withHoverRefusalHint. Please add a contracts test that calls createUnavailablePlatformRuntimeFacts with a hint-less touch cell and expects HOVER_UNAVAILABLE_HINT on hoverPoint and hoverRef. That test fails at 10215d4 and passes on main. A Vega facts assertion on hoverPoint would also work.

Not blocking, and fine to take or leave: the hub now copies about 60 operation keys by hand, and RuntimeFacts only checks that each key is present, not that it carries the value its family builder would derive, so one contracts test comparing the hub against the family builders with the same hint-less cells would close that gap; Apple navigation at runtime.ts:505 and Apple system runtime still bind the whole INTERACTOR_OPERATIONS catalog although their facts cover only a few families, so passing the owner's family rows as tv-cdp and Vega do would match the new pattern.

Not verified here: the code was read only. The tests were not run, the closure and bundle numbers in the PR body were not measured, and how the daemon renders the hover hint to CLI and MCP output was not traced. No budget file changes, so a gate does not lock in the gain. The fact-value change itself is confirmed from the main-side builder and the head hub.

Once the hover hint is restored with that test, this is ready.

… hover legs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Fixed at c46986257e.

  • Behavior: hoverPoint and hoverRef in the hub are wrapped in withHoverRefusalHint again, so a hint-less unavailable touch cell (Vega, gateway unsupported-provider-mode) carries HOVER_UNAVAILABLE_HINT as on main.
  • Test for it: a contracts test calls createUnavailablePlatformRuntimeFacts with a hint-less touch cell and expects the hint on both legs. It fails with the wrap removed (checked).
  • Parity test (optional note, taken): one test gives every family a distinguishable cell and compares the hub's by-name keys with what each family facts builder produces.
  • Not a leaf, and why: I tried the dependency-free leaf first. The eager-closure budget refuses it: touch-runtime.ts goes from 4 to 5 modules and local-interactor-operation-set.ts from 25 to 26, each with added top-level statements, which the gate does not accept as a pure split. Housing the helper in platform-runtime.ts fails the same gate harder (4 to 8 modules). So the hub imports the helper from touch-runtime.ts, which its closure already evaluated at the merge-base. The cost is that an owner built on the hub reaches touch-runtime.ts again; a leaf would need a maintainer row in APPROVED_CLOSURE_ADDITIONS.

Local: build, typecheck, contracts, Vega, tv-cdp and Linux tests, eager-closure budgets, layering, fallow, production-exports.

@apex-sentinel-staging

This comment has been minimized.

…on families

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Second optional note taken at 7976820dbd: the Apple navigation and system runtimes no longer pass the whole INTERACTOR_OPERATIONS catalog. Navigation binds the back, system-button, orientation, tv-remote and keyboard rows; system binds the clipboard, app-event, settings and alert rows, the same families their facts declare. Each gets a test that walks the catalog over four device shapes and fails if the facts admit an operation the runtime does not bind (checked by removing the keyboard rows).

WebDriver, Revyl, Limrun and the shared local set still pass the full catalog; those are left for a later change.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 7976820

Since the review of c469862: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (0731b7a06858).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready. At 7976820 the hover hint is restored: platform-runtime-unavailable.ts wraps both legs in withHoverRefusalHint, and a regression test covers it. That was the finding in the earlier review. Reading the diff, no fact value changes compared to main.

Not blocking, and you can take or leave it: the module doc at platform-runtime-unavailable.ts:23 says the hub never evaluates a family that every owner would then evaluate, but it value-imports withHoverRefusalHint from touch-runtime.ts. One clause naming that import as the single exception would fix it, or the helper can move to a leaf later as a follow-up issue.

All checks pass at 7976820 and there are no conflicts.

Not verified here: the tests were not run locally. The parity test uses hint-carrying cells, so hint-less cells were checked by reading each main-side builder. The Apple walk tests do not cover watchOS, visionOS or iPadOS, which does not change this result. The closure and bundle numbers in the PR body were not measured.

The earlier thread on the hover hint is fixed at this head, so it can be resolved: #4821 (comment).

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 20, 2026
…one family edge

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Optional note taken at 3c89fc25d4: the module doc now names the withHoverRefusalHint import from touch-runtime.ts as the hub's one family edge. Comment-only change.

@thymikee
thymikee merged commit faa3c82 into main Nov 20, 2026
20 of 21 checks passed
@thymikee
thymikee deleted the t3/per-family-operation-binding branch November 20, 2026 17:12
thymikee added a commit that referenced this pull request Nov 20, 2026
…nts-main

* origin/main:
  refactor(contracts): bind only the interactor families an owner implements (#4821)
  refactor(gestures): move gesture algorithms out of contracts into @agent-device/gestures (#4823)
  docs(command-docs): add the shared option table and per-action option tables (#4824)
  docs(agents): hold a review to the PR's invariant and stop at a third round (#4835)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant